package com.hubei.control;

import com.hubei.service.UserService;
import com.hubei.vo.Users;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

//@卢煜  //

@WebServlet("/user_list.action")
public class UserListControl extends HttpServlet {
    private UserService service=UserService.getInstance();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       request.setCharacterEncoding("UTF-8");
       String username=request.getParameter("username");
        List<Users> usersList=service.queryUserList(username);
       request.setAttribute("userList",usersList);
       request.setAttribute("username",username);
       request.getRequestDispatcher("./user_list.jsp").forward(request,response);

    }
    protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}